# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: TBK <alpine@jjtc.eu>
pkgname=kompose
pkgver=1.31.2
pkgrel=0
pkgdesc="Tool to move from docker-compose to Kubernetes"
url="https://kompose.io/"
license="Apache-2.0"
arch="all"
options="chmod-clean !check" # Require access to /tmp + bash, jq, ncurses
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/kubernetes/kompose/archive/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make

	# Generate completion scripts
	./kompose completion bash > completion.bash
	./kompose completion zsh > completion.zsh
	./kompose completion fish > completion.fish
}

package() {
	install -Dm755 $pkgname "$pkgdir"/usr/bin/$pkgname

	install -Dm644 completion.bash "$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 completion.zsh "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
	install -Dm644 completion.fish "$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
}

sha512sums="
44d08269d2c65b4452a5319e8339721fb4c355ea18982b4b0b942511982da9a9d20982f4247499c98ff787496f8ed5c47312f7662065059d8de5fc8380c1d109  kompose-1.31.2.tar.gz
"
